Skip to content

Add info to pytest.fail msg when image not found, to indicate baseline_dir where plugin was looking #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 24, 2018

Conversation

amoodie
Copy link
Contributor

@amoodie amoodie commented Sep 23, 2018

Really simple change to pytest.fail msg for when the plugin fails to find the image at baseline_dir. I'm new to the plugin, and when attempting to use, I struggled for longer than I'd like to admit as to why the test could not find my image.

My baseline_dir was located in my tests folder alongside the test_figs.py test file, as the instructions indicate to do after generating the baseline figures. The instructions also say (on my re-reading now) that the folder is "interpreted as being relative to the test file," but I foolishly was defining @pytest.mark.mpl_image_compare(baseline_dir='tests/figs_baseline').

Anyway, I only figured this out by modifying my installed version of pytest-mpl to determine where the plugin was searching. I'm not sure if anyone else follows my stupidity, but this would be a simple debugging tool for new users. Also might be helpful to add some emphasis to the README in this vein? Or a simple project structure example like below?

src/
  figure_maker.py
  tests/
    test_figure_maker.py
    baseline/
      test_figure_maker_fig1.png
      test_figure_maker_fig2.png

where figure_maker.py is a script or module that produces fig1 and fig2 during normal use.

Anyway, great plugin/utility, thanks!
AM

Copy link
Collaborator

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea - thanks!

@astrofrog astrofrog merged commit 07047c7 into matplotlib:master Sep 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants